<?php

include '../classes/employeeHandler.php';
include '../classes/db.php';

$empno=$_GET['empno'];
$ini=addslashes($_GET['ini']);
$first=addslashes($_GET['first']);
$last=addslashes($_GET['last']);
$gen=$_GET['gender'];

$bdt1=$_GET['bdate'];
$month=substr($bdt1,3,2);
$year=substr($bdt1,6,4);
$day=substr($bdt1,0,2);
$b_dt=$year."-".$month."-".$day;//arrange date formant

$nic=$_GET['nic'];
$add=addslashes($_GET['address']);
$cont=$_GET['contact'];
$email=$_GET['email'];

$jdt1=$_GET['jdate'];
$jmonth=substr($jdt1,3,2);
$jyear=substr($jdt1,6,4);
$jday=substr($jdt1,0,2);
$j_dt=$jyear."-".$jmonth."-".$jday;//arrange date ormat

$quali=$_GET['quali'];
$exe=addslashes($_GET['exe']);
$cat=addslashes($_GET['cat']);

$time_now=mktime(date('H')+5,date('i')+30,date('s'),date('m'),date('d'),date('Y'));
		 $yearnw=date('Y',$time_now); 
 		$monthnw=date('m',$time_now); 
 		$datenw=date('d',$time_now);


$x=new DbConnect();
$con=$x->getConnection();

$emp=new EmployeeHandler();//create a new object
$emp->setCon($con);

//future date validation
if (($year < $yearnw) || (($year == $yearnw)&&($month < $monthnw)) || (($year == $yearnw)&&($month = $monthnw)&&($day <= $datenw)))
	{

			if (($jyear < $yearnw) || (($jyear == $yearnw)&&($jmonth < $monthnw)) || (($jyear == $yearnw)&&($jmonth = $monthnw)&&($jday <= $datenw)))
					{
					$result=$emp->employeeupdate($empno,$ini,$first,$last,$gen,$b_dt,$nic,$add,$cont,$email,$j_dt,$quali,$exe,$cat);
			 		echo $result;
					}
			else 
					{
					echo "Future Join Date !";
					}
	}
else 
	{
		echo "Future Birth Date !";
	}
?>